//! \file WindowAbout.cpp
//! \brief TODO: Document
// -----------------------------------------------------------------------------
//! This program is free software; you can redistribute it and/or
//! modify it under the terms of the GNU General Public License
//! as published by the Free Software Foundation; either version 2
//! of the License, or (at your option) any later version.
//!
//! This program is distributed in the hope that it will be useful,
//! but WITHOUT ANY WARRANTY; without even the implied warranty of
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//! GNU General Public License for more details.
//!
//! You should have received a copy of the GNU General Public License
//! along with this program; if not, write to the Free Software Foundation,
//! Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// -----------------------------------------------------------------------------

#include "Elements.h"
#include "GuiCEGUI.h"
#include <stddef.h>

using namespace CEGUI;

// =====[ Local Definitions ]===================================================

// =====[ Local DataTypes ]=====================================================

// =====[ Local Variables ]=====================================================

// =====[ Local Functions ]=====================================================

// =====[ Private (Internal) Methods ]==========================================

// =====[ Local Implementation ]================================================


// =============================================================================
// FxName
// -----------------------------------------------------------------------------
//! TODO: document
//!
//! \param [in] Arg
//!   TODO: document
//!
//! \retval Exception
//!   The success status of the requested operation.
//!   - eOKAY: Execution occurred as requested.
//!   .
//!
//! \b Example: \code
//! FxName(0);
//! \endcode
// -----------------------------------------------------------------------------
tERROR WindowAbout::create(Window *pParent)
{
  Window *pWindow;

  // If no parent was provided, we will attach it to the root.
  if (pParent == NULL) { pParent = GuiCEGUI::getRoot(); }

  // Create the window.
  pWindow = GuiCEGUI::getWm()->createWindow("TaharezLook/FrameWindow");
  if (pWindow == NULL) { /* TODO: error */ }

  // Configure the menu bar as needed.
  pWindow->setText("About");
  pWindow->setAlwaysOnTop(true);      // Keep it on top.
  pWindow->setModalState(true);
  pWindow->setAlpha(0.5f);

  // TODO: clean below the line ----------------------------

  // position a quarter of the way in from the top-left of parent.
  pWindow->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );

  // set size to be half the size of the parent
  pWindow->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );


  pParent->addChildWindow(pWindow);   // Attach it to the parent.

  // Finally, return no error.
  return (ERR_NONE);
}

